﻿package mortal.game.view.levelReward.other
{
    import __AS3__.vec.*;
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.swfPlayer.*;
    import mortal.common.swfPlayer.data.*;
    import mortal.component.window.resWin.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class LevelRewardVipUpBtn extends ResBasePanel implements IData
    {
        private var _frameIndex:int;
        private var _data:Object;
        private var _index:int;
        private var _btnStyles:Vector.<Array>;
        private var _btnMouseDown:Function;
        private var btnMove:GLoadedButton;
        private var swfPlayer:SWFPlayer;

        public function LevelRewardVipUpBtn()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.btnMove = UIFactory.gLoadedButton(ImagesConst.levelReward_btnbg_upSkin, 0, 3, 185, 71, this);
            this.btnMove.configEventListener(MouseEvent.MOUSE_DOWN, this.onMoveBtnMouseHandler);
            var _loc_1:* = new Array();
            var _loc_2:* = UIFactory.gBitmap(ImagesConst.levelReward_lvtxt, 2, 5, this);
            var _loc_3:* = UIFactory.gBitmap(ImagesConst.levelReward_rank, 100, 35, this);
            var _loc_4:Boolean = false;
            _loc_3.visible = false;
            _loc_2.visible = _loc_4;
            _loc_1.push(_loc_2, _loc_3);
            this._btnStyles = new Vector.<Array>;
            this._btnStyles.push(_loc_1);
            this.swfPlayer = UIFactory.getUICompoment(SWFPlayer);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this.btnMove.dispose(param1);
            this.btnMove = null;
            this._btnStyles = null;
            this.swfPlayer = this.swfPlayer && this.swfPlayer.dispose(param1) ? (null) : (null);
            return;
        }// end function

        override public function refresh(param1:Boolean = false) : void
        {
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            super.refresh(param1);
            if (!allowRefresh)
            {
                return;
            }
            var _loc_2:* = this._btnStyles.length;
            var _loc_5:int = 0;
            while (_loc_5 < _loc_2)
            {
                
                _loc_3 = this._btnStyles[_loc_5].length;
                if (this.frameIndex == _loc_5)
                {
                    _loc_4 = 0;
                    while (_loc_4 < _loc_3)
                    {
                        
                        GBitmap(this._btnStyles[_loc_5][_loc_4]).visible = true;
                        _loc_4++;
                    }
                }
                else
                {
                    _loc_4 = 0;
                    while (_loc_4 < _loc_3)
                    {
                        
                        GBitmap(this._btnStyles[_loc_5][_loc_4]).visible = false;
                        _loc_4++;
                    }
                }
                _loc_5++;
            }
            return;
        }// end function

        private function onMoveBtnMouseHandler(event:MouseEvent) : void
        {
            if (this._btnMouseDown != null)
            {
                this._btnMouseDown(this);
            }
            return;
        }// end function

        public function set btnMouseDown(param1:Function) : void
        {
            this._btnMouseDown = param1;
            return;
        }// end function

        public function get frameIndex() : int
        {
            return this._frameIndex;
        }// end function

        public function set frameIndex(param1:int) : void
        {
            this._frameIndex = param1;
            return;
        }// end function

        public function playEffect() : void
        {
            this.swfPlayer.timeRate = 2;
            this.swfPlayer.move(92, 37);
            this.swfPlayer.load("levelRewardBtn.swf", ModelType.NormalSwf, null);
            addChild(this.swfPlayer);
            return;
        }// end function

        public function stopEffect() : void
        {
            this.swfPlayer.stop();
            DisplayUtil.removeMe(this.swfPlayer);
            return;
        }// end function

        public function get Data()
        {
            return this._data;
        }// end function

        public function set Data(param1) : void
        {
            this._data = param1;
            return;
        }// end function

        public function get index() : int
        {
            return this._index;
        }// end function

        public function set index(param1:int) : void
        {
            this._index = param1;
            return;
        }// end function

    }
}
